NCL ipython notebook test


In [14]:
;-- comment line




In [15]:
filename = "$HOME/NCL/NUG/Version_1.0/data/rectilinear_grid_2D.nc"
system("ncdump -h "+filename)


=
netcdf rectilinear_grid_2D {
dimensions:
        lon = 192 ;
        lat = 96 ;
        time = UNLIMITED ; // (40 currently)
variables:
        double lon(lon) ;
                lon:standard_name = "longitude" ;
                lon:long_name = "longitude" ;
                lon:units = "degrees_east" ;
                lon:axis = "X" ;
        double lat(lat) ;
                lat:standard_name = "latitude" ;
                lat:long_name = "latitude" ;
                lat:units = "degrees_north" ;
                lat:axis = "Y" ;
        double time(time) ;
                time:standard_name = "time" ;
                time:units = "hours since 2001-01-01 00:00:00" ;
                time:calendar = "standard" ;
        float tsurf(time, lat, lon) ;
                tsurf:long_name = "surface temperature" ;
                tsurf:units = "K" ;
                tsurf:code = 169 ;
                tsurf:table = 128 ;
                tsurf:grid_type = "gaussian" ;
        float precip(time, lat, lon) ;
                precip:long_name = "total precipitation" ;
                precip:units = "kg/m^2s" ;
                precip:code = 4 ;
                precip:table = 128 ;
                precip:grid_type = "gaussian" ;
        float u10(time, lat, lon) ;
                u10:long_name = "10m u-velocity" ;
                u10:units = "m/s" ;
                u10:code = 165 ;
                u10:table = 128 ;
                u10:grid_type = "gaussian" ;
        float v10(time, lat, lon) ;
                v10:long_name = "10m v-velocity" ;
                v10:units = "m/s" ;
                v10:code = 166 ;
                v10:table = 128 ;
                v10:grid_type = "gaussian" ;
        float qvi(time, lat, lon) ;
                qvi:long_name = "vertically integrated water vapor" ;
                qvi:units = "kg/m^2" ;
                qvi:code = 230 ;
                qvi:table = 128 ;
                qvi:grid_type = "gaussian" ;
        float slp(time, lat, lon) ;
                slp:long_name = "mean sea level pressure" ;
                slp:units = "Pa" ;
                slp:code = 151 ;
                slp:table = 128 ;
                slp:grid_type = "gaussian" ;
}
>

In [16]:
f = addfile(filename,"r")
printVarSummary(f)


Variable: f
Type: file
File path:	/Users/k204045/NCL/NUG/Version_1.0/data/rectilinear_grid_2D.nc
Number of global attributes:	 0
Number of dimensions:	 3
Number of variables:	 9

In [17]:
t = f->tsurf
printVarSummary(t)


Variable: t
Type: float
Total Size: 2949120 bytes
            737280 values
Number of Dimensions: 3
Dimensions and sizes:	[time | 40] x [lat | 96] x [lon | 192]
Coordinates: 
            time: [   0.. 234]
            lat: [88.57216851400727..-88.57216851400727]
            lon: [-180..178.125]
Number Of Attributes: 5
  grid_type :	gaussian
  table :	128
  code :	169
  units :	K
  long_name :	surface temperature

In [18]:
wks = gsn_open_wks("png","test")




In [19]:
res              =  True
res@gsnFrame     =  False
res@cnFillOn     =  True
res@tiMainString = "Title string"




In [20]:
plot = gsn_csm_contour_map(wks,t(1,:,:),res)




In [21]:
txres = True
txres@txFontHeightF = 0.016




In [22]:
gsn_text_ndc(wks,"new text line",0.5,0.75,txres)




In [23]:
;setvalues plot@contour
;  "cnLinesOn"  :  False
;end setvalues

;draw(plot)




In [24]:
frame(wks)




In [25]:
system("convert -trim +repage test.png test-small.png; rm -rf test.png")


=
>

Display the plot file content in external window using open or display (Code cell): system("open test-small.png")

Display the plot file content inline (Markdown cell): ![title](test-small.png "Title")


In [ ]:


In [ ]: